﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;

namespace Client
{
    public enum SaunaProtocol
    {
        CreateUser,
        Login,
        Logout,
        GetProfile,
        GetUser,
        UpdateProfile,
        DeleteUser,
        OpenChat,
        CloseChat,
        GetUserList,
        ListFriends,
        AddFile,
        NameFile,
        FileExists,
        GetFile,
        ListFiles,
        DeleteFile
    };

    public class Protocol
    {
        public static String Command(SaunaProtocol protocol, String message)
        {
            String data = String.Empty;

            data = "$SAU" + "," + SaunaProtocol(protocol) + "," + message;

            return data;
        }

        private static String SaunaProtocol(SaunaProtocol protocol)
        {
            switch (protocol.ToString())
            {
                case "CreateUser":
                    return "CU";
                    break;

                case "Login":
                    return "LI";
                    break;

                case "Logout":
                    return "LO";
                    break;

                case "GetProfile":
                    return "GP";
                    break;

                case "GetUser":
                    return "GU";
                    break;

                case "UpdateProfile":
                    return "UP";
                    break;


                case "DeleteUser":
                    return "DU";
                    break;

                case "OpenChat":
                    return "OC";
                    break;

                case "CloseChat":
                    return "CC";
                    break;

                case "GetUserList":
                    return "GUL";
                    break;

                case "ListFriends":
                    return "LF";
                    break;

                case "AddFile":
                    return "AF";
                    break;

                case "NameFile":
                    return "NF";
                    break;

                case "FileExists":
                    return "FE";
                    break;
                    

                case "GetFile":
                    return "GF";
                    break;

                case "ListFiles":
                    return "LF";
                    break;

                case "DeleteFile":
                    return "DF";
                    break;

                default:
                    return "";
                    break;
            }
        }
    }
}
